﻿
@{
    ViewBag.Title = "Form";
    Layout = "~/Views/Shared/_Form.cshtml";
}
<style>
    .form .formValue input.form-control {
        height: 34px;
        line-height: 34px;
    }

    .form-control {
        padding: 0px;
    }

    .Table {
        width: 100%;
        margin: 0px;
        padding: 0px;
        border-collapse: collapse;
        border-width: 3px 1px 1px;
        table-layout: fixed;
    }

    .form .formTitle {
        width: 80px;
    }

    .form .formValue textarea.form-control {
        width: 99%;
    }
</style>
<script>
    var orderReserveId = $.request("orderReserveId");
    var checkId = $.request("checkId");
    var F_FlowId = $.request("F_FlowId");
    var ApplyType = $.request("ApplyType");
    var F_CheckUserId = $.request("F_CheckUserId");
    
    $(function () {
        initControl();
    });

    var resultData = {};
    function initControl() {
        resultData = getCache("CHECK_REJECT");
        if (!resultData || resultData.length <= 0) {
            $.ajax({
                url: "/CheckManager/CheckInfos/GetRejectReserveDictionaryItemsJson",
                dataType: "json",
                async: false,
                success: function (data) {
                    if (data.bhly.length > 0) {
                        for (var i = 0; i < data.bhly.length; i++) {
                            $("#F_Reason").append("<option value='" + data.bhly[i].F_ItemCode + "'>" + data.bhly[i].F_ItemName + "</option>");
                        }
                    }
                    setCache("CHECK_REJECT", data);
                }, error: function (XMLHttpRequest, textStatus, errorThrown) {

                }
            });
        } else {
            var data = resultData;
            if (data.bhly.length > 0) {
                for (var i = 0; i < data.bhly.length; i++) {
                    $("#F_Reason").append("<option value='" + data.bhly[i].F_ItemCode + "'>" + data.bhly[i].F_ItemName + "</option>");
                }
            }
        }
    }

    function submitForm() {
        if (!$('#projectForm').formValid()) {
            return false;
        }

        var reason = $('#F_Reason').val();
        var remark = $("#F_Remark").val();

        $.submitForm({
            url: "/CheckManager/CheckInfos/ConfirmReserve?orderReserveId=" + orderReserveId + "&state=" + 2 + "&checkId=" + checkId + "&F_FlowId=" + F_FlowId + "&ApplyType=" + ApplyType + "&F_CheckUserId=" + F_CheckUserId +"",
            param: {
                reason: reason,
                remark: remark
            },
            success: function () {
                top.frames["checkReserve"].$("#gridList").trigger("reloadGrid");
            }
        });
    }
</script>
<div id="ProjectsDetail">
    <form id="projectForm">
        <table class="form">
            <tr>
                <td colspan="6">
                    <table class="Table">
                        <tr>
                            <td class="formTitle">驳回理由</td>
                            <td class="formValue" colspan="3">
                                <select id="F_Reason" name="F_Reason" class="form-control required">
                                    <option value="">==请选择==</option>
                                </select>
                            </td>                                      
                        </tr>
                        <tr>
                            <td class="formTitle">备注</td>
                            <td class="formValue" colspan="3">
                                <textarea id="F_Remark" name="F_Remark" class="form-control required" rows="4"></textarea>
                            </td>
                            <td class="formValue" colspan="1">
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
    </form>
</div>

